import React, { Component } from 'react'

export default class My extends Component {



    componentWillMount = () => this.$push = this.props.history.push;

    loginOut = ()=>{
        localStorage.clear();
        this.$push('/login')
    }

    render() {
        return (
            <div>

                {
                    localStorage.user?<div>{localStorage.user}</div>:
                    <div onClick={()=>this.$push('/login')}>登录/注册</div>    
                }


                 <div onClick={()=>this.loginOut()}>退出</div>
            </div>
        )
    }
}
